<!DOCTYPE html>
<html>
<head>
    <title>JSON 转换器</title>
    <script>
        function transformJSON() {
            // 获取原始 JSON
            var originalJSON = document.getElementById('originalJSON').value;
            try {
                var jsonObject = JSON.parse(originalJSON);

                // 转换逻辑
                jsonObject.name = "dress";
                delete jsonObject.crs; // 删除 crs 属性
                jsonObject.features.forEach(function(feature) {
                    feature.geometry.type = "Polygon"; // 改变类型为 Polygon
                    // 简化坐标数组（仅适用于 MultiPolygon 到 Polygon 的简单案例）
                    feature.geometry.coordinates = feature.geometry.coordinates[0][0];
                    // 移除不需要的属性
                    delete feature.properties.left;
                    delete feature.properties.top;
                    delete feature.properties.right;
                    delete feature.properties.bottom;
                    delete feature.properties.row_index;
                    delete feature.properties.col_index;
                    delete feature.properties.id_2;
                });

                // 显示转换后的 JSON
                document.getElementById('transformedJSON').value = JSON.stringify(jsonObject, null, 4);
            } catch (e) {
                alert('输入的 JSON 格式不正确: ' + e.message);
            }
        }
        // 获取当前时间的时间戳（毫秒）
var timestamp = Date.now();

console.log(timestamp);

    </script>
</head>
<body>
    <h2>JSON 转换器</h2>
    <textarea id="originalJSON" rows="10" cols="50"></textarea><br>
    <button onclick="transformJSON()">转换 JSON</button><br>
    <textarea id="transformedJSON" rows="10" cols="50"></textarea>
</body>
</html>
